<!--
/**************************************************
* @ operatoradd.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/14, Jenny Li
*  1) first release
/**************************************************
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="../../common.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--<link href="<%=root%>/css/css.css" rel="stylesheet" type="text/css">-->
<LINK rel="stylesheet" href="css/caigouxitong.css">
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<title>新增操作员</title>
<%
	HashMap tMap = (HashMap)request.getAttribute("Organization2");
%>
<%
if(message == null){
%>
<script language="JavaScript">

  function change2(optval){
  		var val = optval;
		if(val=='00'){
			var listbox = document.getElementById("operOrg2");
			listbox.length = 0;
			var option = new Option();
		  	option.text="----二级----";
			option.value = "00";			
			listbox.options[listbox.length] = option;
		}else{
  	<%
  		if(tMap !=null){
	 	   	Collection tCollection = tMap.keySet();
	        Iterator tIterator = tCollection.iterator();
  		       while(tIterator.hasNext()){

  		           String tKey = (String)tIterator.next();
  		           ArrayList tList = (ArrayList)tMap.get(tKey);
  	%>
  				if(val == '<%=tKey%>'){
	  				var counter;
	  				var listbox = document.getElementById("operOrg2");
	  				listbox.length = 0;  		  		  											
	  				 				  											
	<%					
					for(int n=0;n<tList.size();n++){
					    GSOrganizationBean tGSOrganizationBean = (GSOrganizationBean)tList.get(n);
					    String categoryId = tGSOrganizationBean.getGs_org_id();
					    String categoryName = tGSOrganizationBean.getGs_org_name();
	%>				
						var temp1 = '<%=categoryId%>';
						var temp2 = '<%=categoryName%>|<%=categoryId%>';
						var option = new Option();
						option.value = temp1;
						option.text = temp2;
						listbox.options[listbox.length] = option;						
	<%
					}
	%>
  				}
  				
  	<%
  		    }
  		}
  	%>
  	}	
	}
	function process(param){
  	    var iFields1 = new Array(5);
        iFields1[0] = 'operId||操作员帐号||Y||1-10||##';
        iFields1[1] = 'operName||操作员姓名||Y||1-20||##';
        iFields1[2] = 'operPwd||操作员密码||Y||4-10||#ABC';
        iFields1[3] = 'confirmPwd||密码确认||Y||4-10||#ABC';
        iFields1[4] = 'email||电子邮箱||N||1-50||#M';
        var ary = new Array(10);
        if(param == 'S'){
        	if( HiScript.value(operatoraddform.name,iFields1) == false)  return false;	
        	if(operatoraddform.operPwd.value != operatoraddform.confirmPwd.value){
        		alert("两次输入的密码不一致，请重新输入！");
        		return;
        	}
			if(!checkTel(operatoraddform.contactTel.value)){
				alert("电话号码只能输入字符：0-9或'-'");
				return;
			}
        	if(operatoraddform.operOrg.value == '00'){
        		alert("请选择操作员所属单位！");
        		return;
        	}
        	
        	ary[0] = operatoraddform.operId.value;
        	ary[1] = operatoraddform.operName.value;
        	ary[2] = operatoraddform.operPwd.value;
        	ary[3] = operatoraddform.confirmPwd.value;
        	ary[4] = operatoraddform.operPostion.value;
        	ary[5] = operatoraddform.operSex.value;
        	ary[6] = operatoraddform.contactTel.value;
        	ary[7] = operatoraddform.email.value;
        	ary[8] = operatoraddform.validity.value;        	        	        	        	
        	ary[9] = operatoraddform.operOrg2.value;         	        	        	        	        	        	
        	window.returnValue = ary;
		    window.close();	 
        }else if(param == 'F'){
        	operatoraddform.action="<%= response.encodeURL(request.getContextPath() + "/A400501.do") %>";
        	operatoraddform.submit();
        }
//       		
//       	window.returnValue = '1';
//		window.close();	  
	}
	function back(){
  
    self.close();
   }
</script>
</head>
<body text="#000000" leftmargin="0" topmargin="0"  marginwidth="0" marginheight="0">
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">操作员管理</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<form name="operatoraddform" method="post" >
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<TR height=20>
					<TD class="bg_column" align=center width="20%">操作员帐号</TD>
					<TD align=left class="bg_row_odd" width="30%"><input type="text" name="operId" maxlength="10" size="20"><font color='red'>&nbsp;*</font></TD>					
					<TD class="bg_column" align=center width="20%">操作员姓名</TD>
					<TD align=left class="bg_row_odd" width="30%"><input type="text" name="operName" maxlength="20" size="20"><font color='red'>&nbsp;*</font></TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>操作员密码</TD>
					<TD align=left class="bg_row_odd"><input type="password" name="operPwd" maxlength="10" size="22"><font color='red'>&nbsp;*</font></TD>									
					<TD class="bg_column" align=center>密码确认</TD>
					<TD left=right class="bg_row_odd">
						<input type="password" name="confirmPwd" maxlength="10" size="22"><font color='red'>&nbsp;*</font>
					</TD>
				</TR>
				<tr>
					<TD class="bg_column" align=center>操作员职位</TD>
					<TD left=right class="bg_row_odd" >
						<input type="text" name="operPostion" maxlength="50">
					</TD>					
					<TD class="bg_column" align=center>操作员性别</TD>
					<TD left=right class="bg_row_odd">
					<select name="operSex">
						<option value="1">女</option>
						<option value="0" selected>男</option>						
					</select>
					</TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>联系电话</TD>
					<TD left=right class="bg_row_odd">
						<input type="text" name="contactTel" maxlength="50">
					</TD>					
					<TD class="bg_column" align=center>电子邮箱</TD>
					<TD left=right class="bg_row_odd">
						<input type="text" name="email" maxlength="50">
					</TD>					
				</TR>				
				<TR height=20>
					<TD class="bg_column" align=center>有效性</TD>
					<TD left=right class="bg_row_odd">
						<select name="validity">
							<option value="0" selected>有效</option>
							<option value="1">无效</option>							
						</select>
					</TD>					
					<TD class="bg_column" align=center>所属单位</TD>
					<TD left=right class="bg_row_odd">
				  <select name="operOrg" onChange="change2(this.value)">
				  <option value="00">----一级----</option>
				    <%//获取所有机构代码
					 ArrayList tOraganization = (ArrayList) request.getAttribute("Oraganization");
				     String tOperOrg = request.getParameter("operOrg");
				     GSOrganizationBean tGSOrganizationBean = null;
					 if (tOraganization != null) {
						for (int n = 0; n < tOraganization.size(); n++) {
						    tGSOrganizationBean = (GSOrganizationBean) tOraganization.get(n);
							if(tOperOrg != null && tOperOrg.equals(tGSOrganizationBean.getGs_org_id())){
					%>
							<option value="<%=tGSOrganizationBean.getGs_org_id()%>" selected>
								<%=tGSOrganizationBean.getGs_org_name()%>|<%=tGSOrganizationBean.getGs_org_id()%>
							</option>
					<%
							}else{
					%>			
							<option value="<%=tGSOrganizationBean.getGs_org_id()%>">
								<%=tGSOrganizationBean.getGs_org_name()%>|<%=tGSOrganizationBean.getGs_org_id()%>
							</option>
					<%
							}
						}
					}
					%>
				 </select>
				<select id="operOrg2" name="operOrg2">			
				  <option value="00">----二级----</option>
						<%
							String tManufType2 = request.getParameter("operOrg2");
							if(tOperOrg != null && !tOperOrg.equals("00")){
							    ArrayList temp = (ArrayList)tMap.get(tOperOrg);
							    if(temp!= null && temp.size() > 0){
									for(int i=0; i<temp.size(); i++){
									    GSOrganizationBean tGSManuf2 = (GSOrganizationBean)temp.get(i);
									    if(tManufType2 != null && tManufType2.equals(tGSManuf2.getGs_org_id())){
							%>
									<option value="<%=tManufType2%>" selected><%=tGSManuf2.getGs_org_name()%>|<%=tGSManuf2.getGs_org_id()%></option>
							<%			        
									    }else{
							%>
									<option value="<%=tGSManuf2.getGs_org_id()%>"><%=tGSManuf2.getGs_org_name()%>|<%=tGSManuf2.getGs_org_id()%></option>
									
							<%			}	
									}
							    }
							}
						%>

						</select><font color='red'>&nbsp;*</font>
									
					</TD>					
				</TR>				
			</table>
		</td>
	</tr>
</table>
</form>
    <p align="center">  
<!--		<input type="image" src="<%=root%>/images/button/zengjia.gif" width="58" height="24" class="box" onclick="process('S')">			-->
<!--		<input type="image" src="<%=root%>/images/button/fanhui.gif" width="58" height="24" class="box" onclick="javascript:return process('F')"/>&nbsp;	-->
<input type="button" value="增加" onClick="process('S')" class="kuang">
<input type="button" value="关闭" onClick="back()" class="kuang">
    </p>

</body>
<%
  } 
%>
</html>